$(function() {
    let devId=$("#devId");
    getDevId();
    devId.on("change",function () {//post请求转播放页面
        postRequest(devId.val());
    })
    function postRequest(param) {
        document.write("<form action='video' method='post' name='myform' style='display:none'>");
        document.write("<input type='hidden' name='devid' value='"+param+"'/>");
        document.write("</form>");
        document.myform.submit();
    }
    function getDevId() {//get请求获取该用户所拥有的设备识别号
        $.ajax({
            url:"video",
            method:"get",
            dataType:"json",
            success:function (resp) {
                devId.empty()
                $(resp).each(function (index,element) {
                    devId.append("<option value='"+element+"'>"+element+"</option>")
                })
            }
        })
    }
})



